package com.chenglu.android.common.profile;

/**
 *  @author lyj
 *  @Created by Copyright © 2023 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 *  @Description：编译环境相关的配置管理类
 */
public class ProfileManager {

    private IProfileFactory mFactory;
    private IProfile mProfile;
    public static final ProfileManager inst;

    public void factory(IProfileFactory factory) {
        this.mFactory = factory;
    }

    public static IProfile profile() {
        return inst.getProfile();
    }

    private IProfile getProfile() {
        if (this.mProfile == null) {
            this.mProfile = this.mFactory.createProfile();
        }
        return this.mProfile;
    }

    private ProfileManager() {
    }

    static {
        inst = Holder.holder;
    }

    private static final class Holder {
        private static final ProfileManager holder = new ProfileManager();

        private Holder() {
        }
    }
}
